home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windows 95 API Bible
/
Windows 95 API Bible 3 Disc Set.iso
/
Win32 API Bible Book 1 of 3.iso
/
include
/
outstr.c
< prev
next >
Wrap
Text File
|
1995-01-19
|
1KB
|
50 lines
// Fill in borland library.
#undef FillMemory
void FillMemory( LPTSTR lpszBuffer, int Bytes, BYTE c )
{
memset( lpszBuffer, c, Bytes );
}
#undef ZeroMemory
void ZeroMemory( LPTSTR lpszBuffer, int Bytes )
{
memset( lpszBuffer, 0, Bytes );
}
// Simple utility routine that shows progression.
// This is used in most multithreaded synchronization programs.
OutputString(HWND hWnd, LPSTR lpszOperation)
{
TCHAR szBuffer[512]; // work area for print formatting
SYSTEMTIME st; // time here.
static int row = 0;
static int msg_num = 1;
HDC hDC = GetDC( hWnd );
GetLocalTime( &st );
FillMemory( szBuffer, 100, 32 );
TextOut( hDC, 0, row, szBuffer, 100 );
// Message number and tick count are printed with message to help
// illustrate the synchronization of activity.
#if defined(OUTSTR_JUST_MESSAGE)
wsprintf( szBuffer, "%s", lpszOperation );
#elif defined(OUTSTR_SHOW_TIME)
wsprintf( szBuffer, "At %2d:%2d:%2d:%3d -> %s",
st.wHour, st.wMinute, st.wSecond, st.wMilliseconds,
lpszOperation );
#else // show message number
wsprintf( szBuffer, "%3d: %s", msg_num++, lpszOperation );
#endif
TextOut( hDC, 0, row, szBuffer, lstrlen( szBuffer ) );
if ( row > 200 )
row = 0;
else
row += 20;
ReleaseDC( hWnd, hDC );
}